<template>
<el-row>
    <el-row>
    <!--新增/编辑界面 SmsFlow 短信流水-->
        <el-form :model="editForm"  label-width="120px" :rules="editFormRules" ref="editFormRef">
            <el-form-item label="短信流水ID" prop="id">
                <el-input  v-model="editForm.id" placeholder="短信流水ID" :maxlength="64" @change="editSomeFields(editForm,'id',$event)" :disabled="  disabledJudge('id')"/>
            </el-form-item>
            <el-form-item label="短信模板ID" prop="smsTempateId">
                <el-input  v-model="editForm.smsTempateId" placeholder="短信模板ID" :maxlength="64" @change="editSomeFields(editForm,'smsTempateId',$event)" :disabled="  disabledJudge('smsTempateId')"/>
            </el-form-item>
            <el-form-item label="发送的实际内容" prop="content">
                <el-input  v-model="editForm.content" placeholder="发送的实际内容" :maxlength="65535" @change="editSomeFields(editForm,'content',$event)" :disabled="  disabledJudge('content')"/>
            </el-form-item>
            <el-form-item label="发送人ID" prop="sendUserid">
                <el-input  v-model="editForm.sendUserid" placeholder="发送人ID" :maxlength="64" @change="editSomeFields(editForm,'sendUserid',$event)" :disabled="  disabledJudge('sendUserid')"/>
            </el-form-item>
            <el-form-item label="接收人ID" prop="receiveUserid">
                <el-input  v-model="editForm.receiveUserid" placeholder="接收人ID" :maxlength="64" @change="editSomeFields(editForm,'receiveUserid',$event)" :disabled="  disabledJudge('receiveUserid')"/>
            </el-form-item>
            <el-form-item label="国家码" prop="nationcode">
                <el-input  v-model="editForm.nationcode" placeholder="国家码" :maxlength="20" @change="editSomeFields(editForm,'nationcode',$event)" :disabled="  disabledJudge('nationcode')"/>
            </el-form-item>
            <el-form-item label="手机号码" prop="mobile">
                <el-input  v-model="editForm.mobile" placeholder="手机号码" :maxlength="30" @change="editSomeFields(editForm,'mobile',$event)" :disabled="  disabledJudge('mobile')"/>
            </el-form-item>
            <el-form-item label="短信签名内容" prop="smsSign">
                <el-input  v-model="editForm.smsSign" placeholder="短信签名内容" :maxlength="64" @change="editSomeFields(editForm,'smsSign',$event)" :disabled="  disabledJudge('smsSign')"/>
            </el-form-item>
            <el-form-item label="短信模板参数" prop="smsTemplateParams">
                <el-input  v-model="editForm.smsTemplateParams" placeholder="短信模板参数" :maxlength="64" @change="editSomeFields(editForm,'smsTemplateParams',$event)" :disabled="  disabledJudge('smsTemplateParams')"/>
            </el-form-item>
            <el-form-item label="短信模板内容" prop="smsTemplateText">
                <el-input  v-model="editForm.smsTemplateText" placeholder="短信模板内容" :maxlength="255" @change="editSomeFields(editForm,'smsTemplateText',$event)" :disabled="  disabledJudge('smsTemplateText')"/>
            </el-form-item>
            <el-form-item label="创建时间" prop="createDate">
                <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.createDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disabledJudge('createDate')"></el-date-picker>
            </el-form-item>
            <el-form-item label="发送者的机构编号" prop="sendBranchId">
                <el-input  v-model="editForm.sendBranchId" placeholder="发送者的机构编号" :maxlength="64" @change="editSomeFields(editForm,'sendBranchId',$event)" :disabled="  disabledJudge('sendBranchId')"/>
            </el-form-item>
            <el-form-item label="发送者商户号码" prop="sendShopId">
                <el-input  v-model="editForm.sendShopId" placeholder="发送者商户号码" :maxlength="64" @change="editSomeFields(editForm,'sendShopId',$event)" :disabled="  disabledJudge('sendShopId')"/>
            </el-form-item>
            <el-form-item label="发送者门店编号，如果是总部店则为0" prop="sendLocationId">
                <el-input  v-model="editForm.sendLocationId" placeholder="发送者门店编号，如果是总部店则为0" :maxlength="64" @change="editSomeFields(editForm,'sendLocationId',$event)" :disabled="  disabledJudge('sendLocationId')"/>
            </el-form-item>
            <el-form-item label="0发送成功1待发送2发送失败3发送中4结束" prop="sendStatus">
                <el-input  v-model="editForm.sendStatus" placeholder="0发送成功1待发送2发送失败3发送中4结束" :maxlength="1" @change="editSomeFields(editForm,'sendStatus',$event)" :disabled="  disabledJudge('sendStatus')"/>
            </el-form-item>
            <el-form-item label="发送详情，如果发送失败，记录失败信息" prop="sendDetail">
                <el-input  v-model="editForm.sendDetail" placeholder="发送详情，如果发送失败，记录失败信息" :maxlength="255" @change="editSomeFields(editForm,'sendDetail',$event)" :disabled="  disabledJudge('sendDetail')"/>
            </el-form-item>
            <el-form-item label="发送时间" prop="sendTime">
                <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.sendTime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disabledJudge('sendTime')"></el-date-picker>
            </el-form-item>
            <el-form-item label="扩展字段" prop="extendNo">
                <el-input  v-model="editForm.extendNo" placeholder="扩展字段" :maxlength="64" @change="editSomeFields(editForm,'extendNo',$event)" :disabled="  disabledJudge('extendNo')"/>
            </el-form-item>
            <el-form-item label="批量处理号码" prop="batchNo">
                <el-input  v-model="editForm.batchNo" placeholder="批量处理号码" :maxlength="64" @change="editSomeFields(editForm,'batchNo',$event)" :disabled="  disabledJudge('batchNo')"/>
            </el-form-item>
            <el-form-item label="批量处理锁编号" prop="lockNo">
                <el-input  v-model="editForm.lockNo" placeholder="批量处理锁编号" :maxlength="64" @change="editSomeFields(editForm,'lockNo',$event)" :disabled="  disabledJudge('lockNo')"/>
            </el-form-item>
            <el-form-item label="0未锁定1锁定" prop="lockStatus">
                <el-input  v-model="editForm.lockStatus" placeholder="0未锁定1锁定" :maxlength="64" @change="editSomeFields(editForm,'lockStatus',$event)" :disabled="  disabledJudge('lockStatus')"/>
            </el-form-item>
            <el-form-item label="0待扣费1已扣费2扣费失败" prop="serviceChargesStatus">
                <el-input  v-model="editForm.serviceChargesStatus" placeholder="0待扣费1已扣费2扣费失败" :maxlength="1" @change="editSomeFields(editForm,'serviceChargesStatus',$event)" :disabled="  disabledJudge('serviceChargesStatus')"/>
            </el-form-item>
            <el-form-item label="扣费时间" prop="serviceChargesTime">
                <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.serviceChargesTime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disabledJudge('serviceChargesTime')"></el-date-picker>
            </el-form-item>
            <el-form-item label="短信计费条数" prop="number">
                <el-input  v-model="editForm.number" placeholder="短信计费条数" :maxlength="5" :disabled="  disabledJudge('number')"/>
            </el-form-item>
            <el-form-item label="0:不需要回复，1待回复，2已回复" prop="replyStatus">
                <el-input  v-model="editForm.replyStatus" placeholder="0:不需要回复，1待回复，2已回复" :maxlength="1" @change="editSomeFields(editForm,'replyStatus',$event)" :disabled="  disabledJudge('replyStatus')"/>
            </el-form-item>
            <el-form-item label="回复截至时间" prop="replyEndDate">
                <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.replyEndDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disabledJudge('replyEndDate')"></el-date-picker>
            </el-form-item>
        </el-form>
    </el-row>
    <slot name="footer" :page="this">
        <el-row v-if="showBtn!==false" style="float:right;" class="footer">
            <el-button @click.native="close">关闭</el-button>
            <el-button v-if="currOpType=='add'" v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="disabledJudge('addBtn') || !checkBtnQx('addBtn',menuDefId) || load.edit">提交</el-button>
        </el-row>
    </slot>
</el-row>
</template>

<script>
import * as SmsFlowApi from '@/api/mdp/sms/smsFlow';
import { mapGetters } from 'vuex'
import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js';

export default {
    name:'smsFlowForm',
    mixins:[MdpFormMixin],
    components: {
    },
    computed: {
    },
    props:{
    },
    watch: {
    },
    data() {
        return {
            menuDefId:'',//menu_def.id 菜单表菜单编号，用于按钮权限判断
            pkNames:["id"],//表格主键的java属性名称，驼峰命名，默认为id,支持多主键
            currOpType:'add',//表单 add、edit，所有按钮可动、detail-只看不能操作
            editFormRules: {
                id:[
                //{ required: true, message: '此项必填', trigger: 'change' },
                //{ min: 1,max: 200, message: '长度在1到200之间', trigger: 'change'}
                ]
            },
            editForm: {
                id:'',smsTempateId:'',content:'',sendUserid:'',receiveUserid:'',nationcode:'',mobile:'',smsSign:'',smsTemplateParams:'',smsTemplateText:'',createDate:'',sendBranchId:'',sendShopId:'',sendLocationId:'',sendStatus:'',sendDetail:'',sendTime:'',extendNo:'',batchNo:'',lockNo:'',lockStatus:'',serviceChargesStatus:'',serviceChargesTime:'',number:'',replyStatus:'',replyEndDate:''
            },
            //增删改查(含批量)接口
            apis:{
                queryById: SmsFlowApi.querySmsFlowById,
                add: SmsFlowApi.addSmsFlow,
                edit: SmsFlowApi.editSmsFlow,
                editSomeFields: SmsFlowApi.editSomeFieldsSmsFlow
            },
            editable:true,//是否可编辑模式
        }
    },
    methods: {
         //由组件扩展添加其它的初始页面的逻辑(mounted+onOpen都会调用此函数，建议只添加公共逻辑)
         initCurrData(){

         },
        /**
         * 检查参数是否满足调用后台接口的条件
         * @returns true / false
         */
        preParamCheck(params){
            return true;
        },
        /**
         * 对修改的字段进行判断，返回false ,将取消更新数据库,由组件扩展
         * @param {*} row 当前选中的行
         * @param {*} fieldName 修改的字段名
         * @param {*} $event 修改后的值
         * @param {*} params 将要提交服务器的参数
         * @returns true/false 返回false ,将取消更新数据库
         */
        editSomeFieldsCheck(row,fieldName,$event,params){
            if(this.editable==false){
                return false;
            }
            params[fieldName]=$event
            return true;
        },
    },
    mounted() {

    }
}

</script>

<style scoped>

</style>